//
//  RootScreenView.m
//  NaRiLSVMT
//
//  Created by jmsre on 14-8-19.
//  Copyright (c) 2014年 helloyouth.org. All rights reserved.
//

#import "RootScreenView.h"
#import "SVGloble.h"
#import "TopScreenView.h"
#import "UIImageView+AFNetworking.h"

#define POSITIONID (int)(scrollView.contentOffset.x/(Screen_Width-20))

@implementation RootScreenView
@synthesize viewNameArray;

//+ (RootScreenView *)shareInstance {
//    static RootScreenView *_instance;
//    static dispatch_once_t onceToken;
//    dispatch_once(&onceToken, ^{
//        _instance=[[self alloc] initWithFrame:CGRectMake(0, 0, Screen_Width-20, 430-40)];
//    });
//    return _instance;
//}


- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        // Initialization code
        self.backgroundColor = [UIColor lightGrayColor];
        self.userInteractionEnabled = YES;
        
        userContentOffsetX = 0;
    }
    return self;
}

- (void)initWithViews:(NSInteger)index
{
//    NSString *baseUrl = @"http://192.168.0.240:8080/visurebuild2013/player_image";
//    NSString *fileURL = [[NSString stringWithFormat:@"%@/%@%@",baseUrl,[viewNameArray objectAtIndex:index],@".png"]stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
    self.detailPicureImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, Screen_Width-20, 430-40)];
    
//    [self.detailPicureImageView setImageWithURL:[NSURL URLWithString:fileURL]];
    
    
    [self.detailPicureImageView setImage:[[DownloadImage sharedInstance] getUrlImage:[viewNameArray objectAtIndex:index] Block:^(UIImage *image){
                                              [self.detailPicureImageView setImage:image];
                                          }]];
    
    [self addSubview:self.detailPicureImageView];
    
    [[TimerDownImage sharedInstance] downCallBackData:[viewNameArray objectAtIndex:index] CallBack:^(UIImage *image){
        [self.detailPicureImageView setImage:image];
//        [self addSubview:self.detailPicureImageView];
    }];
    
}



/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect
{
    // Drawing code
}
*/

@end
